home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / aal / debug.h < prev    next >
C/C++ Source or Header  |  2006-01-09  |  1KB  |  64 lines

  1. /* Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
  2.    libaal/COPYING.
  3.    
  4.    debug.h -- asserts implementation. */
  5.  
  6. #ifndef AAL_DEBUG_H
  7. #define AAL_DEBUG_H
  8.  
  9. #ifdef HAVE_CONFIG_H
  10. #  include <config.h>
  11. #endif
  12.  
  13. extern void __actual_bug(char *hint, char *file, int line, 
  14.              char *func, char *text, ...);
  15.  
  16. extern void __actual_assert(char *hint, int cond, char *text,
  17.                 char *file, int line, char *func);
  18.  
  19. #if !defined(ENABLE_MINIMAL) && defined(ENABLE_DEBUG)
  20. #ifdef __GNUC__
  21. #define aal_bug(hint, text, list...)         \
  22.         __actual_bug(hint,                   \
  23.              __FILE__,             \
  24.              __LINE__,             \
  25.              __PRETTY_FUNCTION__,    \
  26.              text,             \
  27.              ##list)
  28.  
  29. #define aal_assert(hint, cond)               \
  30.         __actual_assert(hint,                \
  31.             cond,             \
  32.             #cond,             \
  33.             __FILE__,         \
  34.             __LINE__,         \
  35.             __PRETTY_FUNCTION__)
  36.  
  37. #else
  38. #define aal_bug(hint, text, list...)         \
  39.         __actual_bug(hint,                   \
  40.              "unknown",             \
  41.              0,                     \
  42.              "unknown",              \
  43.              text,             \
  44.              ##list)
  45.  
  46. #define aal_assert(hint, cond)               \
  47.     __actual_assert(hint, cond,          \
  48.             #cond,             \
  49.             "unknown",         \
  50.             0,             \
  51.             "unknown")
  52.  
  53. #endif
  54.  
  55. #else
  56. #define aal_bug(hint, text, list...)
  57. #define aal_assert(hint, cond)
  58. #endif
  59.  
  60. extern assert_handler_t aal_assert_get_handler(void);
  61. extern void aal_assert_set_handler(assert_handler_t handler);
  62. #endif
  63.  
  64.